import request from '../request'
import { AxiosResponse } from 'axios'
import { LoginFrom } from '@/types/views/login'
import { ResponseData } from '@/types/api/public'
// import { LoginSuccess, UserInfo, RouterData } from '@/types/api/login'

type ConfigType<T=ResponseData> = Promise<AxiosResponse<T>>



/**
 * @desc: get请求
 */
 export const getguanggaolist = ({page,page_size}): ConfigType => {
  return request({
    url: `/guanggaolist?page=${page}&page_size=${page_size}`,
    method: 'get'
  })
}

/**
 * @desc: post添加
 * @param { Object } data
 */
 export const addguanggaolist = (data:LoginFrom): ConfigType => {
  return request({
    url: '/guanggaolist',
    method: 'post',
    data:data._object.formState
  })
}

/**
 * @desc: delete 删除
 * @param { Object } data
 */
 export const delguanggaolist = (id:any): ConfigType => {
  return request({
    url: '/guanggaolist?id='+id,
    method: 'delete',
  })
}

/**
 * @desc: post修改
 * @param { Object } data
 */
 export const putguanggaolist = (data:LoginFrom): ConfigType => {
    return request({
      url: '/guanggaolist',
      method: 'put',
      data:data._object.formState2
    })
  }